{% extends 'base.html' %}
{% load i18n %}
{% load static %}
{% load sizeformat %}
{% load tz %}

{% block head %}
    {#    <link rel="stylesheet" type="text/css" href="{% static 'vms/vms_list.css' %}">#}
    <style>
        .mouse-hover:hover .mouse-hover-show {
            display: inline-block;
        }

        .mouse-hover-show {
            display: none;
        }

        .line-limit-length {
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }
    </style>
{% endblock %}
{% block title %}{% translate '虚拟机详情' %}{% endblock %}

{% block boby %}
    <div class="container-fluid col-12">
        <div class="card">
            <div class="card-header">
                <span class="card-title"><strong>{% translate '虚拟机详情' %}</strong></span>
                <div class="float-right">
                    <a class="btn btn-sm btn-success" href="{% url 'vms:vm-create' %}">{% translate '创建虚拟机' %}</a>
                    <a class="btn btn-sm btn-info" id="id-vm-list-url"
                       href="{% url 'vms:vms-list' %}">{% translate '虚拟机列表' %}</a>
                </div>
            </div>
            <div class="card-body">
                <div class="text-center h3">
                    {% if vm.mac_ip %}
                        <strong>{{ vm.ipv4 }}</strong>
                    {% elif vm.last_ip %}
                        <strong>{{ vm.last_ip.ipv4 }}</strong>
                    {% else %}
                        <strong>{% translate '无ip' %}</strong>
                    {% endif %}

                    (<span id="id-vm-uuid">{{ vm.hex_uuid }}</span>)
                    {% include 'vm_operations.html' %}
                    <span class="h5" id="vm_task_{{ vm.hex_uuid }}"></span>
                </div>
                <div>
                    <ul class="list-group">
                        <li class="list-group-item list-group-item-info">
                            <div class="row">
                                <div class="col-2"></div>
                                <div class="col-10">
                                    <div class="row">
                                        <div class="col-4">
                                            {% if vm.vm_status == vm.VmStatus.NORMAL.value %}
                                                <strong>{% translate '运行状态' %}：</strong>
                                                <div class="btn-group">
                                                    <span id="vm_status_{{ vm.hex_uuid }}"></span>
                                                </div>

                                                {% include 'vm_operations.html' %}
                                                <span class="h5" id="vm_task_{{ vm.hex_uuid }}"></span>
                                                <button class="btn btn-sm btn-outline-success btn-update-vm-status"><i
                                                        class="fa fa-sync"></i></button>
                                            {% else %}
                                                <strong>{% translate '虚拟机状态' %}：</strong>
                                                <span id="vm_status_{{ vm.vm_status }}"
                                                      title="{{ vm.vm_status }}">{{ vm.get_vm_status_display }}</span>
                                            {% endif %}
                                        </div>
                                        <div class="col-4"><strong>{% translate '创建者' %}：</strong>{{ vm.user }}</div>
                                        {% timezone request.session.useTimeZone|default:'UTC' %}
                                            <div class="col-4">
                                                <strong>{% translate '创建时间' %}
                                                    ：</strong>{{ vm.create_time|date:'Y-m-d H:i:s' }}
                                                <span>{{ request.session.useTimeZoneOffset }}</span>
                                            </div>
                                        {% endtimezone %}
                                    </div>
                                </div>
                            </div>
                        </li>
                        <li class="list-group-item list-group-item-success">
                            <div class="row">
                                <div class="col-md-2"><strong>{% translate '位置信息' %}</strong></div>
                                <div class="col-md-10">
                                    <div class="row">
                                        <div class="col-md-4">
                                            <strong>{% translate '所属数据中心' %}：</strong>{{ vm.host.group.center.name }}
                                        </div>
                                        <div class="col-md-4">
                                            <strong>{% translate '所属集群' %}：</strong>{{ vm.host.group.name }}</div>

                                        <div class="col-md-4"><strong>{% translate '宿主机IP地址' %}：</strong>
                                            {% if vm.host %}
                                                {{ vm.host.ipv4 }}
                                            {% else %}
                                                {% translate '暂无' %}
                                            {% endif %}
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </li>
                        <li class="list-group-item list-group-item-warning">
                            <div class="row row_style">
                                <div class="col-md-2"><strong>{% translate '配置信息' %}</strong></div>
                                <div class="col-md-10">
                                    <div class="row">
                                        <div class="col-md-4"><strong>CPU：</strong>{{ vm.vcpu }}</div>
                                        <div class="col-md-4"><strong>MEMORY：</strong>{{ vm.mem|sizeformat:'GB' }}</div>
                                        <div class="col-md-4"><strong>SYS
                                            DISK：</strong>{{ vm.sys_disk_size|sizeformat:'GB' }}</div>
                                    </div>
                                </div>
                            </div>
                        </li>
                        <li class="list-group-item list-group-item-danger">
                            <div class="row">
                                <div class="col-md-2"><strong>{% translate '镜像信息' %}</strong></div>
                                <div class="col-md-10">
                                    <div class="row">
                                        <div class="col-md-4">
                                            <strong>{% translate '系统镜像' %}</strong>：{{ vm.image_name }}</div>
                                        <div class="col-md-4">
                                            <strong>CEPH{% translate '集群' %}</strong>：{{ vm.ceph_pool.ceph.name }}
                                        </div>
                                        <div class="col-md-4"><strong>Pool Name</strong>：{{ vm.ceph_pool.pool_name }}
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </li>
                        <li class="list-group-item list-group-item-info">
                            <div class="row">
                                <div class="col-md-2"><strong>{% translate '网络信息' %}</strong></div>
                                <div class="col-md-10">
                                    <div class="row">
                                        {% if vm.mac_ip %}
                                            <div class="col-md-4">
                                                <strong>IP{% translate '地址' %}：</strong>{{ vm.ipv4 }}</div>
                                            <div class="col-md-4">
                                                <strong>MAC{% translate '地址' %}：</strong>{{ vm.mac_ip.mac }}</div>
                                            <div class="col-md-4">
                                                <strong>VLAN{% translate '描述' %}：</strong>{{ vm.mac_ip.vlan }}</div>
                                            <div class="col-md-4">
                                                <strong>IPv6{% translate '地址' %}：</strong>{{ vm.mac_ip.ipv6 | default_if_none:''}}
                                            </div>
                                            <div class="col-md-4">
                                                <strong>{% translate '网桥名' %}：</strong>{{ vm.mac_ip.vlan.br }}</div>
                                        {% elif vm.last_ip %}
                                            <div class="col-md-4">
                                                <strong>{% translate '原IP地址' %}：</strong>{{ vm.last_ip.ipv4 }}</div>
                                            <div class="col-md-4">
                                                <strong>{% translate '原MAC地址' %}：</strong>{{ vm.last_ip.mac }}</div>
                                            <div class="col-md-4">
                                                <strong>{% translate '原IPv6地址' %}：</strong>{{ vm.mac_ip.ipv6 }}</div>
                                            <div class="col-md-4">
                                                <strong>VLAN{% translate '描述' %}：</strong>{{ vm.last_ip.vlan }}</div>
                                            <div class="col-md-4">
                                                <strong>{% translate '原网桥名' %}：</strong>{{ vm.last_ip.vlan.br }}
                                            </div>
                                        {% else %}

                                            <div class="col-md-4"><strong>IP{% translate '地址' %}：</strong>无</div>
                                            <div class="col-md-4"><strong>MAC{% translate '地址' %}：</strong>无</div>
                                            <div class="col-md-4"><strong>{% translate '原IPv6地址' %}：</strong>无</div>
                                            <div class="col-md-4"><strong>VLAN{% translate '描述' %}：</strong>无</div>
                                            <div class="col-md-4"><strong>{% translate '网桥名' %}：</strong>无</div>
                                        {% endif %}
                                    </div>
                                </div>
                            </div>
                        </li>
                        <li class="list-group-item list-group-item-info">
                            <div class="row">
                                <div class="col-md-2"><strong>{% translate '用户信息' %}</strong></div>
                                <div class="col-md-10">
                                    <div class="row">
                                        <div class="col-md-4">
                                            <strong>{% translate '默认用户名' %}：</strong>{{ vm.default_user }}</div>
                                        <div class="col-md-4"><strong>{% translate '默认密码' %}：</strong>
                                            {% if vm.init_password %} {{ vm.init_password }} {% else %}
                                                {{ vm.default_password }} {% endif %}</div>
                                    </div>
                                </div>
                            </div>
                        </li>
                        <li class="list-group-item list-group-item-success">
                            <div class="row">
                                <div class="col-md-2"><strong>{% translate '备注信息' %}</strong></div>
                                <div class="col-md-10 mouse-hover">
                                    <div>
                                        <span>{{ vm.remarks|default_if_none:'无' }}</span>
                                        <span class="mouse-hover-show edit_vm_remark" vm_uuid="{{ vm.hex_uuid }}"
                                              title="{% translate '修改备注' %}">
                                            <i class="fa fa-edit"></i>
                                        </span>
                                    </div>
                                    <div id="remarks_edit" style="display:none">
                                        <textarea id="remarks">{{ vm.remarks|default_if_none:'' }}</textarea>
                                        <span class="save_vm_remark" title="{% translate '保存备注' %}"
                                              vm_uuid="{{ vm.hex_uuid }}">
                                            <i class="fa fa-save"></i>
                                        </span>
                                    </div>
                                </div>
                            </div>
                        </li>

                        <li class="list-group-item list-group-item-info">
                            <div class="row">
                                <div class="col-md-2"><strong>{% translate '功能按键' %}</strong></div>
                                <div class="col-md-10">
                                    <div class="row">
                                        <div style="display: flex">
                                            <div>
                                                <a class="btn-outline-primary"
                                                   href="{% url 'vms:vm-edit' vm_uuid=vm.hex_uuid %}">{% translate '修改配置' %}</a>

                                            </div>

                                            <div style="margin-left: 20px">
                                                <a class="btn-outline-primary"
                                                   href="{% url 'vms:vm-bandwidth' vm_uuid=vm.hex_uuid %}">{% translate '修改带宽配置' %}</a>

                                            </div>
                                            <div style="margin-left: 20px">
                                                <a class="btn-outline-primary"
                                                   href="{% url 'vms:vm-reset' vm_uuid=vm.hex_uuid %}">{% translate '重置镜像' %}</a>

                                            </div>
                                            {% if not vm.is_sys_disk_local %}
                                                <div style="margin-left: 20px">
                                                    <a class="btn-outline-primary"
                                                       href="{% url 'vms:vm-migrate' vm_uuid=vm.hex_uuid %}">{% translate '关机迁移' %}</a>

                                                </div>

                                                <div style="margin-left: 20px">
                                                    <a class="btn-outline-primary"
                                                       href="{% url 'vms:vm-live-migrate' vm_uuid=vm.hex_uuid %}">{% translate '动态迁移' %}</a>
                                                </div>

                                                {% if vm.vm_status == vm.VmStatus.NORMAL.value %}
                                                    <div style="margin-left: 20px">
                                                        <a class="btn-outline-primary btn-vm-shelve" type="button"
                                                           href="#"
                                                           data-vm-uuid="{{ vm.hex_uuid }}">{% translate '搁置' %}</a>
                                                    </div>
                                                {% else %}
                                                    <div style="margin-left: 20px">
                                                        <a class="btn-outline-primary"
                                                           href="{% url 'vms:unshelve' vm_uuid=vm.hex_uuid %}">{% translate '搁置虚拟机恢复' %}</a>
                                                    </div>
                                                    <div style="margin-left: 20px">
                                                        <a class="btn-outline-primary btn-vm-delshelve"
                                                           type="button" href="#" style="color: red"
                                                           data-vm-uuid="{{ vm.hex_uuid }}">{% translate '删除搁置虚拟机' %}</a>

                                                    </div>
                                                {% endif %}
                                                <div style="margin-left: 20px">
                                                    <a class="btn-outline-primary btn-vm-miss-fix"
                                                       type="button" href="#"
                                                       data-vm-uuid="{{ vm.hex_uuid }}">{% translate '丢失恢复' %}</a>

                                                </div>
                                                <div style="margin-left: 20px">
                                                    <a class="btn-outline-primary"
                                                       href="{% url 'vms:vm-image-release' vm_uuid=vm.hex_uuid %}">{% translate '发布镜像' %}</a>


                                                </div>
                                            {% endif %}

                                            <div style="margin-left: 20px">
                                                <a class="btn-outline-primary btn-vm-delete"
                                                   type="button" href="#" style="color: red"
                                                   data-vm-uuid="{{ vm.hex_uuid }}">{% translate '删除虚拟机' %}</a>

                                            </div>
                                            <div style="margin-left: 20px">
                                                <a class="btn-outline-primary btn-vm-delete-force"
                                                   type="button" href="#" style="color: red"
                                                   data-vm-uuid="{{ vm.hex_uuid }}">{% translate '强制删除虚拟机' %}</a>

                                            </div>

                                        </div>


                                    </div>
                                </div>

                            </div>
                        </li>

                        <li class="list-group-item">
                            <div style="display: flex">
                                <div style="width: 4%">
                                    <p><strong>{% translate '云硬盘' %}</strong></p>
                                </div>
                                <div>
                                    {% if vm.vm_status == vm.VmStatus.NORMAL.value %}
                                        <a class="btn-outline-primary"
                                           href="{% url 'vms:vm-mount-disk' vm_uuid=vm.hex_uuid %}">{% translate '挂载云硬盘' %}</a>
                                        <a class="btn-outline-primary"
                                           href="{% url 'vms:vm-sys-disk-expand' vm_uuid=vm.hex_uuid %}">{% translate '系统盘扩容' %}</a>
                                    {% endif %}
                                </div>

                            </div>

                            {% with vm.vdisks as vdisks %}
                                {% if vdisks %}
                                    <table class="table table-default text-center table-disk-list"
                                           style="word-wrap:break-word;word-break:break-all;">
                                        <thead class="thead-light">
                                        <tr>
                                            <th>{% translate '设备' %}</th>
                                            <th>UUID</th>
                                            <th>{% translate '机组' %}</th>
                                            <th>{% translate '存储池' %}</th>
                                            <th>{% translate '容量' %}</th>
                                            <th>{% translate '用户' %}</th>
                                            <th>{% translate '创建时间' %}
                                                <span>{{ request.session.useTimeZoneOffset }}</span></th>
                                            <th>{% translate '状态' %}</th>
                                            <th>{% translate '备注' %}</th>
                                            <th>{% translate '操作' %}</th>
                                        </tr>
                                        </thead>
                                        <tbody>
                                        {% for disk in vdisks %}
                                            <tr id="tr_{{ disk.uuid }}">
                                                <td>{{ disk.dev }}</td>
                                                <td class="line-limit-length" style="max-width: 150px;"
                                                    title="{{ disk.uuid }}"><b>{{ disk.uuid }}</b></td>
                                                <td>{{ disk.quota.group }}</td>
                                                <td>{{ disk.quota }}</td>
                                                <td>{{ disk.size|sizeformat:'GB' }}</td>
                                                <td>{{ disk.user }}</td>
                                                {% timezone request.session.useTimeZone|default:'UTC' %}
                                                    <td>{{ disk.create_time | date:'Y-m-d H:i:s' }}</td>
                                                {% endtimezone %}
                                                <td>
                                                    {% if disk.enable %}
                                                        <i class="fa fa-check"></i>
                                                    {% else %}
                                                        <i class="fa fa-times"></i>
                                                    {% endif %}
                                                </td>
                                                <td>
                                                    <span>{{ disk.remarks|default_if_none:'' }}</span>
                                                </td>
                                                <td>
                                                    <button type="button" class="btn btn-sm btn-danger btn-disk-umount"
                                                            data-disk-uuid="{{ disk.uuid }}">{% translate '卸载' %}
                                                    </button>
                                                </td>
                                            </tr>
                                        {% endfor %}
                                        </tbody>
                                    </table>
                                {% else %}
                                    {% translate '未挂载云硬盘' %}
                                {% endif %}
                            {% endwith %}
                        </li>
                        <li class="list-group-item">
                            <div style="display: flex">
                                <div style="width: 6%"><p><strong>{% translate '本地资源设备' %}</strong></p></div>
                                <div>
                                    {% if vm.vm_status == vm.VmStatus.NORMAL.value %}
                                        <a class="btn-outline-primary"
                                           href="{% url 'vms:vm-mount-pci' vm_uuid=vm.hex_uuid %}">{% translate '挂载本地设备' %}</a>
                                    {% endif %}
                                </div>
                            </div>

                            {% with vm.pci_devices as devices %}
                                {% if devices %}
                                    <table class="table table-default text-center table-pci-list"
                                           style="word-wrap:break-word;word-break:break-all;">
                                        <thead class="thead-light">
                                        <tr>
                                            <th>ID</th>
                                            <th>类型</th>
                                            <th>{% translate '地址' %}</th>
                                            <th>{% translate '宿主机' %}</th>
                                            <th>{% translate '机组' %}</th>
                                            <th>{% translate '状态' %}</th>
                                            <th>{% translate '备注' %}</th>
                                            <th>{% translate '操作' %}</th>
                                        </tr>
                                        </thead>
                                        <tbody>
                                        {% for dev in devices %}
                                            <tr id="tr_{{ dev.id }}">
                                                <td><b>{{ dev.id }}</b></td>
                                                <td>{{ dev.type_display }}</td>
                                                <td>{{ dev.address }}</td>
                                                <td>{{ dev.host.ipv4 }}</td>
                                                <td>{{ dev.host.group }}</td>
                                                <td>
                                                    {% if dev.enable %}
                                                        <i class="fa fa-check"></i>
                                                    {% else %}
                                                        <i class="fa fa-times"></i>
                                                    {% endif %}
                                                </td>
                                                <td><span>{{ dev.remarks|default_if_none:'' }}</span></td>
                                                <td>
                                                    <button type="button" class="btn btn-sm btn-danger btn-pci-unmount"
                                                            data-pci-id="{{ dev.id }}">{% translate '卸载' %}
                                                    </button>
                                                </td>
                                            </tr>
                                        {% endfor %}
                                        </tbody>
                                    </table>
                                {% else %}
                                    {% translate '未挂载本地资源设备' %}
                                {% endif %}
                            {% endwith %}
                        </li>
                        <li class="list-group-item" id="id-vm-snap-content">
                            <div style="display: flex">
                                <div style="width: 6%"><p><strong>{% translate '虚拟机快照' %}</strong></p></div>
                                <div>
                                    {% if vm.vm_status == vm.VmStatus.NORMAL.value %}
                                        {% if vm.is_sys_disk_local %}
                                            <button class="btn-outline-primary  disabled">{% translate '创建快照' %}</button>
                                        {% else %}
                                            <a class="btn-outline-primary btn-vm-snap-create" href="#"
                                               data-vm-uuid="{{ vm.hex_uuid }}">{% translate '创建快照' %}</a>
                                        {% endif %}
                                    {% endif %}
                                </div>
                            </div>
                            {% if vm.sys_snaps %}
                                <table class="table table-default text-center table-vm-snap-list"
                                       style="word-wrap:break-word;word-break:break-all;">
                                    <thead class="thead-light">
                                    <tr>
                                        <th>ID</th>
                                        <th>{% translate '快照' %}</th>
                                        <th>{% translate '创建时间' %}
                                            <span>{{ request.session.useTimeZoneOffset }}</span></th>
                                        <th>{% translate '备注' %}</th>
                                        <th>{% translate '操作' %}</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    {% for snap in vm.sys_snaps %}
                                        <tr id="tr_snap_{{ snap.id }}">
                                            <td>{{ snap.id }}</td>
                                            <td class="line-limit-length" style="max-width: 150px;"
                                                title="{{ snap.snap }}">{{ snap.snap }}</td>
                                            {% timezone request.session.useTimeZone|default:'UTC' %}
                                                <td>{{ snap.create_time |date:'Y-m-d H:i:s' }}</td>
                                            {% endtimezone %}
                                            <td class="mouse-hover">
                                                <div>
                                                    <span>{{ snap.remarks|default_if_none:'' }}</span>
                                                    <span class="mouse-hover-show edit-vm-snap-remark"
                                                          title="{% translate '修改备注' %}">
                                                        <i class="fa fa-edit"></i>
                                                    </span>
                                                </div>
                                                <div style="display:none">
                                                    <textarea
                                                            id="remarks">{{ snap.remarks|default_if_none:'' }}</textarea>
                                                    <span class="save-vm-snap-remark" title="{% translate '保存备注' %}"
                                                          data-snap-id="{{ snap.id }}">
                                                        <i class="fa fa-save"></i>
                                                    </span>
                                                </div>
                                            </td>
                                            <td>
                                                <button type="button" class="btn btn-sm btn-danger btn-vm-snap-delete"
                                                        data-snap-id="{{ snap.id }}">{% translate '删除' %}
                                                </button>
                                                <button type="button" class="btn btn-sm btn-danger btn-vm-snap-rollback"
                                                        data-snap-id="{{ snap.id }}">{% translate '回滚' %}
                                                </button>
                                            </td>
                                        </tr>
                                    {% endfor %}
                                    </tbody>
                                </table>
                            {% else %}
                                {% translate '未创建快照' %}
                            {% endif %}
                        </li>
                        <li class="list-group-item">
                            <div style="display: flex">
                                <div style="width: 8%"><p><strong>{% translate '附加IP地址列表' %}</strong></p></div>
                                <div>
                                    {% if vm.vm_status == vm.VmStatus.NORMAL.value %}
                                        <a class="btn-outline-primary"
                                           href="{% url 'vms:vm-attach-ip' vm_uuid=vm.hex_uuid %}">{% translate '附加IP地址' %}</a>
                                    {% endif %}
                                </div>
                            </div>
                            {% with vm.get_attach_ip as att_ip %}
                                {% if att_ip %}
                                    <table class="table table-default text-center table-disk-list"
                                           style="word-wrap:break-word;word-break:break-all;">
                                        <thead class="thead-light">
                                        <tr>
                                            <th>IP{% translate '地址' %}</th>
                                            <th>MAC{% translate '地址' %}</th>
                                            <th>{% translate '网桥名' %}</th>
                                            <th>VLAN{% translate '描述' %}</th>
                                            <th>{% translate '标签' %}</th>
                                            <th>{% translate '操作' %}</th>
                                        </tr>
                                        </thead>
                                        <tbody>
                                        {% for att in att_ip %}
                                            <tr id="tr_">
                                                <td>{{ att.sub_ip.ipv4 }}</td>
                                                <td>{{ att.sub_ip.mac }}</td>
                                                <td>{{ att.sub_ip.vlan.br }}</td>
                                                <td>{{ att.sub_ip.vlan.name }}</td>
                                                <td>{{ att.sub_ip.vlan.get_tag_display }}</td>

                                                <td>
                                                    <button class="btn btn-sm btn-danger btn-vm-detach-ip"
                                                            data-detach-ip-id="{{ att.sub_ip.id }}"
                                                            data-vm-uuid="{{ vm.hex_uuid }}">{% translate '移除' %}</button>

                                                </td>
                                            </tr>
                                        {% endfor %}
                                        </tbody>
                                    </table>
                                {% else %}
                                    {% translate '未附加IP地址' %}
                                {% endif %}
                            {% endwith %}
                        </li>
                        <li class="list-group-item" id="id-vm-snap-content">
                            <p><strong>{% translate '虚拟机状态' %}</strong></p>
                            <div class="row">
                                <div class="col-6">
                                    <canvas id="chart-vm-cpu"></canvas>
                                </div>
                                <div class="col-6">
                                    <canvas id="chart-vm-mem"></canvas>
                                </div>
                                <div class="col-6">
                                    <canvas id="chart-vm-disk"></canvas>
                                </div>
                                <div class="col-6">
                                    <canvas id="chart-vm-network"></canvas>
                                </div>
                            </div>
                        </li>
                        <li class="list-group-item" id="id-vm-shared-users-content">
                            <p><strong>{% translate '共享用户' %}</strong></p>
                            {% if vm_shared_users %}
                                <table class="table table-default text-center table-vm-shared-users-list"
                                       style="word-wrap:break-word;word-break:break-all;">
                                    <thead class="thead-light">
                                    <tr>
                                        <th>ID</th>
                                        <th>{% translate '用户' %}</th>
                                        <th>{% translate '权限' %}</th>
                                        <th>{% translate '创建时间' %}
                                            <span>{{ request.session.useTimeZoneOffset }}</span></th>
                                        <th>{% translate '备注' %}</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    {% for sh_user in vm_shared_users %}
                                        <tr id="tr_shared-user_{{ sh_user.id }}">
                                            <td>{{ sh_user.id }}</td>
                                            <td class="line-limit-length" style="max-width: 150px;"
                                                title="{{ sh_user.user.username }}">{{ sh_user.user.username }}</td>
                                            <td>{{ sh_user.get_permission_display }}</td>
                                            {% timezone request.session.useTimeZone|default:'UTC' %}
                                                <td>{{ sh_user.create_time |date:'Y-m-d H:i:s' }}</td>
                                            {% endtimezone %}
                                            <td>{{ sh_user.remarks }}</td>
                                        </tr>
                                    {% endfor %}
                                    </tbody>
                                </table>
                            {% else %}
                                {% translate '无共享用户' %}
                            {% endif %}
                        </li>
                    </ul>
                </div>
            </div>
        </div>
    </div>
{% endblock %}

{% block script %}
    <script type="text/javascript" src="{% static 'chartjs/chart-3.4.1.min.js' %}"></script>
    <script type="text/javascript" src="{% static 'evcloud/common.js' %}"></script>
    <script type="text/javascript" src="{% static 'art-template/template-web.js' %}"></script>
    <script type="text/javascript" src="{% static 'vms/vms_operations.js' %}"></script>
    <script type="text/javascript" src="{% static 'vms/vms_detail.js' %}"></script>
    <script type="text/javascript" src="{% static 'vms/vms_attach_ip.js' %}"></script>
    <script type="text/javascript" src="{% static 'vms/vms_shelve_list.js' %}"></script>
{% endblock %}

